<template>
  <view v-if="isWechat" class="go-back" @tap="handleClick">
    <image src="/static/tabs/chevron-left.png" mode="aspectFill"> </image>
  </view>
</template>

<script>
export default {
  name: "GoBack",
  props: {},
  data() {
    return {
      isWechat: false,
    };
  },
  created() {
    // 判断是否为微信小程序环境
    console.log(uni.getSystemInfoSync());
    this.isWechat = uni.getSystemInfoSync().uniPlatform === "mp-weixin";
  },
  methods: {
    handleClick() {
      uni.navigateBack();
    },
  },
};
</script>

<style lang="scss">
.go-back {
  position: fixed;
  top: calc(var(--status-bar-height) + 60rpx);
  left: 20rpx;
  width: 60rpx;
  height: 60rpx;
  padding: 0 8rpx 0 0;
  // border-radius: 26rpx;
  // opacity: 0.6;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  image {
    width: 80%;
    height: 80%;
  }
}
</style>
